package com.example.demo.controller;

import com.example.demo.entity.OrderStatus;
import com.example.demo.service.OrderStatusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class OrderStatusController {

    @Autowired
    OrderStatusService orderStatusService;

    @GetMapping("/orderStatus/{id}")
    public OrderStatus getOrderStatus(@PathVariable("id") Integer id){
        OrderStatus orderStatus = orderStatusService.getOrderStatus(id);
        return orderStatus;
    }

    @GetMapping("/orderStatus")
    public OrderStatus insertOrderStatus(OrderStatus orderStatus){
        OrderStatus save = orderStatusService.insertOrderStatus(orderStatus);
        return  save;
    }
}
